package com.service.edu.mapper;

import com.service.edu.pojo.Course;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * 课程 Mapper 接口
 * </p>
 *
 * @author testjava
 * @since 2020-09-28
 */
@Repository
@Mapper
public interface CourseMapper extends BaseMapper<Course> {

    @Update("update edu_course set  is_deleted=0 where id=#{id}")
    int updateIsDelete(String id);

    @Update("update edu_course set view_count=view_count+1  where id=#{id}")
    int updateViewsCount(String id);

    @Select("select count(1) from edu_course where DATE(gmt_create) = #{day}")
    Integer queryCreateCount(String day);


}
